<%@ page import="edu.zut.pojo.User" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.HashMap" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    request.setAttribute("k1","v1");
    request.setAttribute("num1",100);
    request.setAttribute("num2",200);
    request.setAttribute("imgUrl","......");
    request.getSession().setAttribute("k2","v2");
    request.getServletContext().setAttribute("k3","v3");
    Cookie cookie = new Cookie("k4", "v4");
    response.addCookie(cookie);
    User user = new User("jack", 21);
    request.setAttribute("user",user);
    User user1 = new User("tom", 22);
    List<User> list = new ArrayList<>();
    list.add(user);
    list.add(user1);
    request.setAttribute("list",list);
    Map<String,User> userMap = new HashMap<>();
    userMap.put(user.getName(),user);
    userMap.put(user1.getName(),user1);
    request.setAttribute("userMap",userMap);
%>
<%--指定作用域对象--%>
<p>${requestScope.k1}</p>
<p>${sessionScope.k2}</p>
<p>${applicationScope.k3}</p>
<p>${cookie.k4.name}</p>
<p>${cookie.k4.value}</p>
<%--根据key取值--%>
<p>${k1}</p>
<p>${k2}</p>
<p>${k3}</p>
<p>${num1 + num2}</p>
<p>${num == num2}</p>
<%--空判断--%>
<p>${imgUrl == null}</p>
<br>
${empty imgUrl}
<br>
<%--value是对象时--%>
${user.name}
<br>
${user.age}
<br>
<%--value是集合或数组--%>
${list[0].name}
<br>
${list[0].age}
<br>
<%--value是map--%>
${userMap.jack}
<br>
${userMap.tom}
</body>
</html>
